/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.StringUtil;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.AttributeCallback.SingleValueMod;
/*    */ import com.zimbra.cs.account.Domain;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.grouphandler.ADGroupHandler;
/*    */ import java.util.Date;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GalCallback
/*    */   extends AttributeCallback
/*    */ {
/* 32 */   private String oldValue = null;
/* 33 */   private String newValue = null;
/*    */   
/*    */ 
/*    */ 
/*    */   public void preModify(CallbackContext context, String attrName, Object value, Map attrsToModify, Entry entry)
/*    */     throws ServiceException
/*    */   {
/* 40 */     if (entry != null) {
/* 41 */       this.oldValue = entry.getAttr(attrName, true);
/*    */     }
/* 43 */     AttributeCallback.SingleValueMod mod = singleValueMod(attrsToModify, attrName);
/* 44 */     this.newValue = mod.value();
/* 45 */     if (attrName.equals("zimbraGalLdapFilter")) {
/* 46 */       if (mod.unsetting())
/* 47 */         return;
/* 48 */       if ("ad".equalsIgnoreCase(this.newValue)) {
/* 49 */         attrsToModify.put("zimbraGalLdapGroupHandlerClass", ADGroupHandler.class.getCanonicalName());
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */ 
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry)
/*    */   {
/* 57 */     if ((entry instanceof Domain)) {
/*    */       try {
/* 59 */         if (!StringUtil.equal(this.oldValue, this.newValue)) {
/* 60 */           ((Domain)entry).setGalDefinitionLastModifiedTime(new Date());
/*    */         }
/*    */       } catch (ServiceException e) {
/* 63 */         ZimbraLog.misc.warn("Unable to set zimbraGalDefinitionLastModifiedTime " + e);
/*    */       }
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/GalCallback.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */